import request from '@/utils/request'

// es6 模块化规范 ---- 浏览器环境使用  （nodejs是服务器环境， commonJS模块化规范 exports require）
// 一个js文件只能有一个默认导出（表示可以用任意名称接受 import xxx），
// 可以有多个按需导出(import {xxxx})
export function getDepartmentInfoReqest() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

// 新增部门接口  /company/department
export function addDepartmentRequest(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    // data: data
    data
  })
}

// 根据ID查询部门详情 /company/department/{id}
export function getDeparmentByIdRequest(id) {
  return request({
    // /company/department/12321313123
    // /company/department/324534534543
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

// 根据ID修改部门详情 /company/department/{id}
export function updateDepartmentByIdRequest(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

// 根据ID删除部门  /company/department/{id}
export function deleteDeparmentByIdRequest(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
